package com.cooperate.fly.mapper;

import com.cooperate.fly.bo.Field;
import com.cooperate.fly.datasource.SqlMapper;
import org.apache.ibatis.annotations.Param;


import java.util.List;

import java.util.ArrayList;


@SqlMapper
public interface FieldMapper {
    int deleteByPrimaryKey(Integer id);

    int deleteBySchemaId(Integer schemaId);

    int insert(Field record);

    int insertSelective(Field record);

    Field selectByPrimaryKey(Integer id);

    /**
     * 选出数据库中的数据项
     * @param id
     * @return
     */
    List<Field> selectBySchemaId(Integer id);

    int updateByPrimaryKeySelective(Field record);

    int updateByPrimaryKeyWithBLOBs(Field record);

    int updateByPrimaryKey(Field record);

    //get all field by databaseId;
    ArrayList<Field> selectByDId(int did);
	
	ArrayList<Field> selectByParentId(int parentId);
    int updatePathById(@Param("path")String path,@Param("id")int id);

    Field selectByNameAndParentId(@Param("name")String name, @Param("parentId")int parentId);

    Field selectByNameAndParentIdAndSchemaId(@Param("name")String name, @Param("parentId")int parentId,
                                             @Param("schemaId")int schemaId);

    ArrayList<Field> selectBySchemaIdAndParentId(@Param("schemaId") int schemaId,@Param("parentId") int parentId);
}